#!user/bin/env python3
# -- coding: utf-8 --
import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.edge.service import Service

driver = webdriver.Edge(service=Service('./MicrosoftWebDriver.exe'))
driver.implicitly_wait(3)
driver.get('https://so.gushiwen.cn/user/login.aspx?from=http://so.gushiwen.cn/user/collect.aspx')
# 邮箱
email = driver.find_element(By.ID, 'email')
email.clear()
email.send_keys('1478243841@qq.com')
# 密码
pwd = driver.find_element(By.ID, 'pwd')
pwd.clear()
pwd.send_keys('123456')
# 验证码
code1 = input('请输入验证码：')
code = driver.find_element(By.ID, 'code')
code.clear()
code.send_keys(code1)
# 登录
pwd = driver.find_element(By.ID, 'denglu')
pwd.click()
# 退出
out = driver.find_element(By.XPATH, '//*[@id="mainSearch"]/div[3]/div[1]/div[5]/a')
out.click()
time.sleep(3)
# driver.close()
driver.quit()